<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"
%><%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"
%><%@ taglib prefix="security" uri="http://www.springframework.org/security/tags"
%><%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"
%><%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"
%>
<head>
    <title><fmt:message key="template" /></title>
</head>
<body>
    <h1><fmt:message key="template" /></h1>
    <c:url var="createUrl" value="/domain/template/create.action"/>
    <form:form action="${createUrl}" id="templateForm" modelAttribute="templateForm" >
        <form:errors cssClass="error"/>
        <table>
            <form:hidden path="template.inode"/>
            <tbody>
                <tr>
                    <th><fmt:message key="template_title" /> *</th>
                    <td>
                        <form:input path="template.title"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "template.title",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
									maxLength: 200,
                                    required : true
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="template.title"/>
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="template_friendlyName" /></th>
                    <td>
                        <form:input path="template.friendlyName"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "template.friendlyName",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="template.friendlyName"/>
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="template_type" /></th>
                    <td>
                        <form:select path="template.type">
                            <form:options items="${templateTypeList}" itemValue="value" itemLabel="localDisplayName" />
                        </form:select>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "template.type",
                                widgetType : "dijit.form.FilteringSelect",
                                widgetAttrs : {
                                    required: true
                            }}));
                        </script>
                    </td>
                </tr>

				<!--
                <tr>
                    <th><fmt:message key="template_header" /></th>
                    <td>
                        <form:textarea path="template.header"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "template.header",
                                widgetType : "dijit.form.SimpleTextarea",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="template.header"/>
                    </td>
                </tr>
				-->
                <tr>
                    <th><fmt:message key="template_body" /></th>
                    <td>
                        <form:textarea path="template.body"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "template.body",
                                widgetType : "dijit.form.SimpleTextarea",
                                widgetAttrs : {
									rows: 20,
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="template.body"/>
                    </td>
                </tr>
				<!--
                <tr>
                    <th><fmt:message key="template_footer" /></th>
                    <td>
                        <form:textarea path="template.footer"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "template.footer",
                                widgetType : "dijit.form.SimpleTextarea",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="template.footer"/>
                    </td>
                </tr>
				-->
                <tr>
                    <th><fmt:message key="template_image" /></th>
                    <td>
                        <form:input path="template.image"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "template.image",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="template.image"/>
                    </td>
                </tr>

            </tbody>
            <tfoot>
                <tr>
                    <td colspan="2">
                        <div class="buttons">
                            <button id="saveButton" class="ok" type="submit"><fmt:message key="label.form.submit"/></button>
                            <script type="text/javascript">
                                Spring.addDecoration(new Spring.ValidateAllDecoration({
                                    elementId:'saveButton',
                                    event:'onclick'
                                }));
                            </script>
                        </div>
                    </td>
                </tr>
            </tfoot>
        </table>
    </form:form>
</body>
